def func1(name):
    if name == "小明":
        print(f"{name}爱运动")
    if name == "小红":
        print(f"{name}爱跳舞")
func1("小明")
func1("小红")


class TestName(object):
    def __init__(self,name):
        self.name =name
    def sport(self):
        print(f"{self.name}爱运动")
    def dance(self):
        print(f"{self.name}爱跳舞")
xm = TestName("小明")
xm.sport()
xh = TestName("小红")
xh.dance()